package com.longge;

public class MoveZeroes {
    public void moveZeroes(int[] nums) {
        int numLength = removeElement(nums, 0);
        for (; numLength < nums.length; numLength++) {
            nums[numLength] = 0;
        }
    }

    public int removeElement(int[] nums, int val) {

        int slow = 0, fast = 0;
        while (fast != nums.length) {
            if (nums[fast] != val) {
                nums[slow++] = nums[fast];
            }
            fast++;
        }
        return slow;
    }
}
